{% extends 'list.html' %}

{% with searched="Groups" %}
{% endwith %}

{% block active_groups %}active{% endblock %}

{% block header_buttons %}
<a href="{% url 'account.views.create_group' %}" class="btn btn-primary pull-right" type="button"><i class="icon-plus icon-white"></i> Add a New Group</a>
{% endblock %}

{% block legend %}
Filter the List of Groups
{% endblock %}

{% block filter_help %}Search for Groups{% endblock %}
{% block search_for %}Groups{% endblock %}

{% block specialised_controls %}
<input type="hidden" name="page" value="{{ groups.number }}" />
{% endblock %}

{% block filter_buttons %}
	<button type="submit" class="btn btn-primary" type="button">Filter Groups</button>
	<a href="{% url 'account.views.list_groups' %}" class="btn" type="button">Clear Filter</a>
{% endblock %}


{% block table_headings %}
<th>#</th>
<th id="group-name">Group Name</th>
<th id="group-name" style="text-align: center;">Edit</th>
<th id="group-name" style="text-align: center;">Remove</th>
{% endblock %}

{% block table_body %}
{% if groups %}
  	{% for group in groups %}
    	<tr>
    		<td>{{ forloop.counter }}</td>
    		{% url 'account.views.list_users' as group_url %}
	    	<td><a href='{{ group_url }}?group={{ group.name.split|join:"+" }}'>{{ group.name }}</a></td>
			<td style="text-align: center;"><a href="{% url 'account.views.edit_group' group_id=group.id %}"><i class="icon-edit"></i></a></td>
	    	<td style="text-align: center;"><a href="{% url 'account.views.delete_group' group_id=group.id %}"><i class="icon-remove"></i></a></td>
		</tr>
	{% endfor %}
	{% else %}
	   	<tr class="info">
	   		<td colspan="5">No Groups to display</td>
	   	</tr>
	{% endif %}
{% endblock %}

{% block pagination %}
{% load pagination %}
{% paginate groups %}
{% endblock %}